Component({
	data: {
		active: 0,
		list: [
			{
				icon: '',
				text: '首页',
        url: '/pages/home/home',
        img: '/static/images/tabbar/home.png',
        imgActive: '/static/images/tabbar/home-full.png',
        iconStyle: {
          width: '70rpx',
          height: '40rpx'
        }
			},
      {
				icon: '',
				text: '优圈',
        url: '/pages/circle/circle',
        img: '/static/images/tabbar/circle.png',
        imgActive: '/static/images/tabbar/circle-full.png',
        iconStyle: {
          width: '70rpx',
          height: '40rpx'
        }
      },
      {
				icon: '',
				text: '',
        url: '/pages/publish/publish',
        img: '/static/images/tabbar/publish.png',
        imgActive: '/static/images/tabbar/publish.png',
        iconStyle: {
          width: '200rpx',
          height: '70rpx'
        }
      },
      {
				icon: '',
				text: '商城',
        url: '/pages/shop/shop',
        img: '/static/images/tabbar/shop.png',
        imgActive: '/static/images/tabbar/shop-full.png',
        iconStyle: {
          width: '70rpx',
          height: '40rpx'
        }
      },
      {
				icon: '',
				text: '我的',
        url: '/pages/mine/mine',
        img: '/static/images/tabbar/mine.png',
        imgActive: '/static/images/tabbar/mine-full.png',
        iconStyle: {
          width: '70rpx',
          height: '40rpx'
        }
			}
		]
	},

	methods: {
		onChange(event) {
			this.setData({ active: event.detail });
			wx.switchTab({
				url: this.data.list[event.detail].url
			});
		},

		init() {
			const page = getCurrentPages().pop();
			this.setData({
				active: this.data.list.findIndex(item => item.url === `/${page.route}`)
			});
		}
	}
});
